Telegram Group & Telegram Channel
📚 Мини-справочник по основным типам данных C++

Делимся компактным справочником по основным типам данных в C++. Сохраняйте себе на будущее.

🔢 Целочисленные типы

int — 4 байта, от -2,147,483,648 до 2,147,483,647
short — 2 байта, от -32,768 до 32,767
long — 4 байта (Windows) или 8 байт (Unix)
long long — 8 байт, от -9,223,372,036,854,775,808 до 9,223,372,036,854,775,807

Модификаторы:
unsigned — только положительные числа, удваивает верхний предел
signed — со знаком (по умолчанию)

unsigned int counter = 100;
short temperature = -15;
long long population = 7800000000;


🔡 Символьные типы

char — 1 байт, обычные символы ASCII
wchar_t — 2 или 4 байта, широкие символы (Unicode)
char16_t — 2 байта, символы UTF-16 (C++11)
char32_t — 4 байта, символы UTF-32 (C++11)

char letter = 'A';
wchar_t unicodeChar = L'Ф';
char16_t utf16Char = u'Ж';


🔄 Числа с плавающей точкой

float — 4 байта, точность ~7 цифр, диапазон ±3.4e±38
double — 8 байт, точность ~15 цифр, диапазон ±1.7e±308
long double — 8-16 байт, точность ≥ double, диапазон зависит от компилятора

float price = 19.99f;   // 'f' суффикс для float
double pi = 3.14159265359;
long double precise = 1.23456789123456789L; // 'L' суффикс


🧮 Логический тип

bool — 1 байт, значения: true или false

bool isActive = true;
bool hasPermission = false;


🗄 Производные типы

Массивы: int numbers[5];
Указатели: int* ptr;
Ссылки: int& ref = value;
Строки:
• C-строки: char str[] = "Hello";
• std::string: std::string text = "Hello";

🔄 Автоматическое определение типа (C++11)

auto x = 10;        // int
auto y = 3.14; // double
auto z = "Hello"; // const char*


🧩 Тип Void

void — отсутствие типа (для функций без возвращаемого значения)
void* — указатель на данные любого типа

🔍 Как узнать размер типа


cout << "Размер int: " << sizeof(int) << " байт" << endl;


💡 Полезные советы

1. Используйте **size_t
для индексации и размеров
2. Для целых чисел с гарантированным размером используйте типы из <cstdint>: int32_t, uint64_t
3. Для денежных расчетов избегайте float из-за погрешностей округления

Библиотека C/C++ разработчика #буст



tg-me.com/cppproglib/5526
Create:
Last Update:

📚 Мини-справочник по основным типам данных C++

Делимся компактным справочником по основным типам данных в C++. Сохраняйте себе на будущее.

🔢 Целочисленные типы

int — 4 байта, от -2,147,483,648 до 2,147,483,647
short — 2 байта, от -32,768 до 32,767
long — 4 байта (Windows) или 8 байт (Unix)
long long — 8 байт, от -9,223,372,036,854,775,808 до 9,223,372,036,854,775,807

Модификаторы:
unsigned — только положительные числа, удваивает верхний предел
signed — со знаком (по умолчанию)

unsigned int counter = 100;
short temperature = -15;
long long population = 7800000000;


🔡 Символьные типы

char — 1 байт, обычные символы ASCII
wchar_t — 2 или 4 байта, широкие символы (Unicode)
char16_t — 2 байта, символы UTF-16 (C++11)
char32_t — 4 байта, символы UTF-32 (C++11)

char letter = 'A';
wchar_t unicodeChar = L'Ф';
char16_t utf16Char = u'Ж';


🔄 Числа с плавающей точкой

float — 4 байта, точность ~7 цифр, диапазон ±3.4e±38
double — 8 байт, точность ~15 цифр, диапазон ±1.7e±308
long double — 8-16 байт, точность ≥ double, диапазон зависит от компилятора

float price = 19.99f;   // 'f' суффикс для float
double pi = 3.14159265359;
long double precise = 1.23456789123456789L; // 'L' суффикс


🧮 Логический тип

bool — 1 байт, значения: true или false

bool isActive = true;
bool hasPermission = false;


🗄 Производные типы

Массивы: int numbers[5];
Указатели: int* ptr;
Ссылки: int& ref = value;
Строки:
• C-строки: char str[] = "Hello";
• std::string: std::string text = "Hello";

🔄 Автоматическое определение типа (C++11)

auto x = 10;        // int
auto y = 3.14; // double
auto z = "Hello"; // const char*


🧩 Тип Void

void — отсутствие типа (для функций без возвращаемого значения)
void* — указатель на данные любого типа

🔍 Как узнать размер типа


cout << "Размер int: " << sizeof(int) << " байт" << endl;


💡 Полезные советы

1. Используйте **size_t
для индексации и размеров
2. Для целых чисел с гарантированным размером используйте типы из <cstdint>: int32_t, uint64_t
3. Для денежных расчетов избегайте float из-за погрешностей округления

Библиотека C/C++ разработчика #буст

BY Библиотека C/C++ разработчика | cpp, boost, qt


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/cppproglib/5526

View MORE
Open in Telegram


Библиотека C C разработчика | cpp boost qt Telegram | DID YOU KNOW?

Date: |

Telegram auto-delete message, expiring invites, and more

elegram is updating its messaging app with options for auto-deleting messages, expiring invite links, and new unlimited groups, the company shared in a blog post. Much like Signal, Telegram received a burst of new users in the confusion over WhatsApp’s privacy policy and now the company is adopting features that were already part of its competitors’ apps, features which offer more security and privacy. Auto-deleting messages were already possible in Telegram’s encrypted Secret Chats, but this new update for iOS and Android adds the option to make messages disappear in any kind of chat. Auto-delete can be enabled inside of chats, and set to delete either 24 hours or seven days after messages are sent. Auto-delete won’t remove every message though; if a message was sent before the feature was turned on, it’ll stick around. Telegram’s competitors have had similar features: WhatsApp introduced a feature in 2020 and Signal has had disappearing messages since at least 2016.

The SSE was the first modern stock exchange to open in China, with trading commencing in 1990. It has now grown to become the largest stock exchange in Asia and the third-largest in the world by market capitalization, which stood at RMB 50.6 trillion (US$7.8 trillion) as of September 2021. Stocks (both A-shares and B-shares), bonds, funds, and derivatives are traded on the exchange. The SEE has two trading boards, the Main Board and the Science and Technology Innovation Board, the latter more commonly known as the STAR Market. The Main Board mainly hosts large, well-established Chinese companies and lists both A-shares and B-shares.

Библиотека C C разработчика | cpp boost qt from hk


Telegram Библиотека C/C++ разработчика | cpp, boost, qt
FROM USA